﻿<cfscript>
/** 
* ORM ProgramPlan
* 
* @hint "Hibernate persistenter t_plan. 教学计划课程信息" 
* 
*/ 

component 
	displayname="public.service.orm.senate.ProgramPlan" 
	output=false 
	persistent=true 
	selectBeforeUpdate=true dynamicInsert=true dynamicUpdate=true 
	cacheuse="Transactional" 
	entityname="ProgramPlan" 
	table="t_plan"
	{

	property type="string" name="PlanID" column="p_id" fieldtype="id" generator="assigned" hint="教学计划号";

	property type="string" name="CourseIndex" column="cidx" hint="课序号";
	property type="string" name="SubjectDirection" column="sbj_direction" hint="专业方向号列表";

	property name="FormClass" fieldtype="many-to-one" fkcolumn="cls_id" cfc="FormClass"  hint="班级";
	property name="Course" fieldtype="many-to-one" fkcolumn="cid" cfc="Course"  hint="课程";
	property name="CourseProperty" fieldtype="many-to-one" fkcolumn="prop_id" cfc="CourseProperty"  hint="课程属性";
	property name="CourseNature" fieldtype="many-to-one" fkcolumn="cna_id" cfc="CourseNature"  hint="课程性质";
	property name="Term" fieldtype="many-to-one" fkcolumn="term_id" cfc="Term"  hint="学期";

	/**
	* @hint "自定义主键规则"
	* 
	* @FormClass "班级"
	* @Course "课程"
	*/
	public string function getID( required FormClass, required Course ) output=false {
		
		var nextID = arguments.FormClass.getClassID() & arguments.Course.getCourseID();

		/* 
			主键生成规则 
			
			培养方案号16位 10位班级代码 + 6位课程号

			Unique: CLS_ID, CID
		*/
		return nextID;
	}
}

</cfscript>
